package com.groupbuying.cheetah.service.impl;

import com.groupbuying.cheetah.dao.OrderSettleMapperDao;
import com.groupbuying.cheetah.service.CheetahTmpOrderSettleDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class CheetahTmpOrderSettleDetsilServiceImpl implements CheetahTmpOrderSettleDetailService {
	@Autowired
	private OrderSettleMapperDao orderSettleMapperDao;

	@Override
	public Map<String,Object> getStoreCheckoutCounterList(String[] uuids){
		List<Map<String, Object>> list = orderSettleMapperDao.getStoreCheckoutCounterList(uuids);
		Map<String,Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("uuid");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getStoreMainInfoList(String[] uuids) {
		List<Map<String, Object>> list = orderSettleMapperDao.getStoreMainInfoList(uuids);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("uuid");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getPayOrderRelList(String[] orderIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getPayOrderRelList(orderIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("order_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getPayInfoList(String[] ids) {
		List<Map<String, Object>> list = orderSettleMapperDao.getPayInfoList(ids);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getSettleUshopSplitMaininfoList(String[] orderIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getSettleUshopSplitMaininfoList(orderIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("order_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getSettleUshopFlowStoreList(String[] externalId) {
		List<Map<String, Object>> list = orderSettleMapperDao.getSettleUshopFlowStoreList(externalId);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("external_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getStoreAccountList(String[] providerId) {
		List<Map<String, Object>> list = orderSettleMapperDao.getStoreAccountList(providerId);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("provider_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getSysAgentInfoList(String[] ids) {
		List<Map<String, Object>> list = orderSettleMapperDao.getSysAgentInfoList(ids);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getCustomerWxinfoRelList(String[] customerIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getCustomerWxinfoRelList(customerIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("customer_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getCustomerUshopList(String[] customerIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getCustomerUshopList(customerIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("customer_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getCustomerAliinfoRelList(String[] customerIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getCustomerAliinfoRelList(customerIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("customer_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getSettleUshopSplitPlantformList(String[] settleIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getSettleUshopSplitPlantformList(settleIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("settle_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getSettleUshopSplitStoreList(String[] settleIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getSettleUshopSplitStoreList(settleIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("settle_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getSettleUshopSplitChannleList(String[] settleIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getSettleUshopSplitChannleList(settleIds);
		Map<String, Object> returnMap = new HashMap<>();
		for(Map map:list){
			String uuid = (String) map.get("settle_id");
			returnMap.put(uuid,map);
		}
		return returnMap;
	}

	@Override
	public Map<String, Object> getCurrencyCustomerLogList(String[] payIds) {
		List<Map<String, Object>> list = orderSettleMapperDao.getCurrencyCustomerLogList(payIds);
		Map<String, Object> returnMap = new HashMap<>();
		for (Map map : list) {
			String uuid = (String) map.get("pay_id");
			returnMap.put(uuid, map);
		}
		return returnMap;

	}
}
